{include file="common/header" title="节点管理"}
<style type="text/css">
	.item {
		padding: 5px;
		line-height: 20px;
	}

	.node,
	.node * {
		color: #ccc;
	}

	a {
		cursor: pointer;
	}
</style>
<div class="layui-body">
	<!-- 内容主体区域 -->

	<div class="layui-box" style="padding: 20px;">
		<button type="button" id="addRole" class="layui-btn layui-btn-normal">添加角色</button>
	</div>
	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
		<legend>角色列表</legend>
	</fieldset>
	<div style="padding: 30px;">

		<table class="layui-table" lay-skin="line">
			<colgroup>
				<col width="">
				<col width="200">
				<col>
			</colgroup>
			<thead>
				<tr>
					<th>名称</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				{:buildAdminRoleTable(0)}
			</tbody>
		</table>
	</div>
</div>
<script>
	layui.use(['layer'], function() {
		var layer = layui.layer;
		var $ = layui.jquery;

		$(document).on('click', '#addRole', function() { 
			layer.open({
				type: 2,
				title: '选择节点',
				area: ['90%', '99%'],
				content: './add'
			});
		})


		$(document).on('click', '.selectRule', function() {
			var id = $(this).data('id')
			layer.open({
				type: 2,
				title: '选择节点',
				area: ['90%', '99%'],
				content: './selectRule?roleId=' + id
			});
		})
		
		$(document).on('click', '.editRole', function() {
			var id = $(this).data('id')
			var name = $(this).data('name')
			layer.open({
				type: 2,
				title: '编辑',
				area: ['90%', '99%'],
				content: '/admin/role/edit?id='+id
			});
		})
	});
</script>
{include file="common/footer"}
